#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMutex>

#include "common_global.h"

namespace Ui {
class MainWindow;
}

#define sMainWindow MainWindow::GetInstance()

class COMMONSHARED_EXPORT MainWindow : public QMainWindow
{
    Q_OBJECT
private:
    static MainWindow* sInst;
    static QMutex sInsMutex;
public:

    static MainWindow* GetInstance(){
        if(!sInst){
            sInsMutex.lock();
            if(!sInst){
               sInst = new MainWindow;
            }
            sInsMutex.unlock();
        }
        return sInst;
    }

    void SetTopWidget(QWidget* w);
    void SetButtomWidget(QWidget* w);
    void SetLeftWidget(QWidget* w);
    void SetRightWidget(QWidget* w);

    void SetCenterWidget(QWidget* w);


private:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    MainWindow(const MainWindow&) = delete;
    MainWindow& operator=(const MainWindow&) = delete;

    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
